<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>ES6 常用功能 | 茂茂个人博客</title>
    <meta name="generator" content="VuePress 1.7.1">
    <link rel="icon" href="https://pan.zealsay.com/blog/favicon.ico">
    <script>
          var _hmt = _hmt || [];
          (function() {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?b0aae218897fa9d8a9f76e9a77e0b3c6";
            var s = document.getElementsByTagName("script")[0]; 
            s.parentNode.insertBefore(hm, s);
          })();
        </script>
    <meta name="description" content="开心最重要呀">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
    
    <link rel="preload" href="/vue-press-blog-html/assets/css/0.styles.466ff2da.css" as="style"><link rel="preload" href="/vue-press-blog-html/assets/js/app.0c76d487.js" as="script"><link rel="preload" href="/vue-press-blog-html/assets/js/5.12b1c0e9.js" as="script"><link rel="preload" href="/vue-press-blog-html/assets/js/1.6e6d8766.js" as="script"><link rel="preload" href="/vue-press-blog-html/assets/js/25.006a8aa9.js" as="script"><link rel="prefetch" href="/vue-press-blog-html/assets/js/10.d1650d04.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/11.7dcf07b1.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/12.0f0733e4.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/13.c979057e.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/14.9fb7b8f2.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/15.8ea86eee.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/16.6a2fbcca.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/17.481f1fe6.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/18.8bb85eca.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/19.2c2d2093.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/20.7785d7f0.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/21.da88625b.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/22.283c942f.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/23.f1a0dacf.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/24.1a2dd800.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/26.a2a7c588.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/27.ad0f4c12.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/28.bd2020fd.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/29.8dfd8ec0.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/3.3a1f118a.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/30.ffdc92aa.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/31.1869d54d.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/32.1c9db73f.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/33.0d483b05.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/34.3210bba1.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/35.b62e6ca5.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/36.523400ab.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/37.939dfcd0.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/38.455599c3.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/4.70e76d9d.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/6.a759eba0.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/7.0caf748e.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/8.dc1bf2a5.js"><link rel="prefetch" href="/vue-press-blog-html/assets/js/9.5483e0b1.js">
    <link rel="stylesheet" href="/vue-press-blog-html/assets/css/0.styles.466ff2da.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container no-sidebar" data-v-0c5314fc><div data-v-0c5314fc><div id="loader-wrapper" class="loading-wrapper" data-v-d48f4d20 data-v-0c5314fc data-v-0c5314fc><div class="loader-main" data-v-d48f4d20><div data-v-d48f4d20></div><div data-v-d48f4d20></div><div data-v-d48f4d20></div><div data-v-d48f4d20></div></div> <!----> <!----></div> <div class="password-shadow password-wrapper-out" style="display:none;" data-v-5cb9a64e data-v-0c5314fc data-v-0c5314fc><h3 class="title" style="display:none;" data-v-5cb9a64e data-v-5cb9a64e>茂茂个人博客</h3> <!----> <label id="box" class="inputBox" style="display:none;" data-v-5cb9a64e data-v-5cb9a64e><input type="password" value="" data-v-5cb9a64e> <span data-v-5cb9a64e>Konck! Knock!</span> <button data-v-5cb9a64e>OK</button></label> <div class="footer" style="display:none;" data-v-5cb9a64e data-v-5cb9a64e><span data-v-5cb9a64e><i class="iconfont reco-theme" data-v-5cb9a64e></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-5cb9a64e>vuePress-theme-reco</a></span> <span data-v-5cb9a64e><i class="iconfont reco-copyright" data-v-5cb9a64e></i> <a data-v-5cb9a64e><span data-v-5cb9a64e>茂茂</span>
            
          <span data-v-5cb9a64e>2019 - </span>
          2022
        </a></span></div></div> <div class="hide" data-v-0c5314fc><div data-v-0c5314fc><div id="smart" class="wrapper-page" style="background-image:url(/vue-press-blog-html/articleImage/img08.jpeg);background-position-x:center;background-position-y:center;background-size:cover;background-repeat-x:no-repeat;background-repeat-y:no-repeat;" data-v-0c5314fc><header class="navbar" data-v-0c5314fc><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/vue-press-blog-html/" class="home-link router-link-active"><img src="/vue-press-blog-html/logo.png" alt="茂茂个人博客" class="logo"> <span class="site-name">茂茂个人博客</span></a> <div class="links"><div id="dayNightSwitch" class="generalWrapper" data-v-32f44868><a class="click" data-v-32f44868><div class="onOff daySwitch" data-v-32f44868><div class="star star1" data-v-32f44868></div> <div class="star star2" data-v-32f44868></div> <div class="star star3" data-v-32f44868></div> <div class="star star4" data-v-32f44868></div> <div class="star star5" data-v-32f44868></div> <div class="star sky" data-v-32f44868></div> <div class="sunMoon" data-v-32f44868><div class="crater crater1" data-v-32f44868></div> <div class="crater crater2" data-v-32f44868></div> <div class="crater crater3" data-v-32f44868></div> <div class="cloud part1" data-v-32f44868></div> <div class="cloud part2" data-v-32f44868></div></div></div></a></div> <div class="search-box"><i class="iconfont reco-search"></i> <input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/vue-press-blog-html/" class="nav-link"><i class="iconfont reco-home"></i>
  主页
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-category"></i>
      博客
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/vue-press-blog-html/categories/编辑/" class="nav-link"><i class="iconfont undefined"></i>
  编辑
</a></li><li class="dropdown-item"><!----> <a href="/vue-press-blog-html/categories/vue/" class="nav-link"><i class="iconfont undefined"></i>
  vue
</a></li><li class="dropdown-item"><!----> <a href="/vue-press-blog-html/categories/工具使用/" class="nav-link"><i class="iconfont undefined"></i>
  工具使用
</a></li><li class="dropdown-item"><!----> <a href="/vue-press-blog-html/categories/读书/" class="nav-link"><i class="iconfont undefined"></i>
  读书
</a></li><li class="dropdown-item"><!----> <a href="/vue-press-blog-html/categories/前端/" class="nav-link"><i class="iconfont undefined"></i>
  前端
</a></li><li class="dropdown-item"><!----> <a href="/vue-press-blog-html/categories/python/" class="nav-link"><i class="iconfont undefined"></i>
  python
</a></li><li class="dropdown-item"><!----> <a href="/vue-press-blog-html/categories/node/" class="nav-link"><i class="iconfont undefined"></i>
  node
</a></li><li class="dropdown-item"><!----> <a href="/vue-press-blog-html/categories/可视化/" class="nav-link"><i class="iconfont undefined"></i>
  可视化
</a></li><li class="dropdown-item"><!----> <a href="/vue-press-blog-html/categories/高德地图/" class="nav-link"><i class="iconfont undefined"></i>
  高德地图
</a></li><li class="dropdown-item"><!----> <a href="/vue-press-blog-html/categories/ios/" class="nav-link"><i class="iconfont undefined"></i>
  ios
</a></li><li class="dropdown-item"><!----> <a href="/vue-press-blog-html/categories/react/" class="nav-link"><i class="iconfont undefined"></i>
  react
</a></li></ul></div></div><div class="nav-item"><a href="/vue-press-blog-html/tag/" class="nav-link"><i class="iconfont reco-tag"></i>
  标签
</a></div><div class="nav-item"><a href="/vue-press-blog-html/timeline/" class="nav-link"><i class="iconfont reco-date"></i>
  时间轴
</a></div><div class="nav-item"><a href="/vue-press-blog-html/about/" class="nav-link"><i class="iconfont reco-account"></i>
  关于
</a></div> <!----></nav></div></header> <div class="sidebar-mask" data-v-0c5314fc></div> <aside class="sidebar" data-v-0c5314fc><div class="personal-info-wrapper" data-v-03833281 data-v-0c5314fc><img src="/vue-press-blog-html/logo.png" alt="author-avatar" class="personal-img" data-v-03833281> <h3 class="name" data-v-03833281>
    茂茂
  </h3> <div class="num" data-v-03833281><div data-v-03833281><h3 data-v-03833281>25</h3> <h6 data-v-03833281>文章</h6></div> <div data-v-03833281><h3 data-v-03833281>21</h3> <h6 data-v-03833281>标签</h6></div></div> <hr data-v-03833281></div> <nav class="nav-links"><div class="nav-item"><a href="/vue-press-blog-html/" class="nav-link"><i class="iconfont reco-home"></i>
  主页
</a></div><div class="nav-item"><div class="dropdown-wrapper"><a class="dropdown-title"><span class="title"><i class="iconfont reco-category"></i>
      博客
    </span> <span class="arrow right"></span></a> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/vue-press-blog-html/categories/编辑/" class="nav-link"><i class="iconfont undefined"></i>
  编辑
</a></li><li class="dropdown-item"><!----> <a href="/vue-press-blog-html/categories/vue/" class="nav-link"><i class="iconfont undefined"></i>
  vue
</a></li><li class="dropdown-item"><!----> <a href="/vue-press-blog-html/categories/工具使用/" class="nav-link"><i class="iconfont undefined"></i>
  工具使用
</a></li><li class="dropdown-item"><!----> <a href="/vue-press-blog-html/categories/读书/" class="nav-link"><i class="iconfont undefined"></i>
  读书
</a></li><li class="dropdown-item"><!----> <a href="/vue-press-blog-html/categories/前端/" class="nav-link"><i class="iconfont undefined"></i>
  前端
</a></li><li class="dropdown-item"><!----> <a href="/vue-press-blog-html/categories/python/" class="nav-link"><i class="iconfont undefined"></i>
  python
</a></li><li class="dropdown-item"><!----> <a href="/vue-press-blog-html/categories/node/" class="nav-link"><i class="iconfont undefined"></i>
  node
</a></li><li class="dropdown-item"><!----> <a href="/vue-press-blog-html/categories/可视化/" class="nav-link"><i class="iconfont undefined"></i>
  可视化
</a></li><li class="dropdown-item"><!----> <a href="/vue-press-blog-html/categories/高德地图/" class="nav-link"><i class="iconfont undefined"></i>
  高德地图
</a></li><li class="dropdown-item"><!----> <a href="/vue-press-blog-html/categories/ios/" class="nav-link"><i class="iconfont undefined"></i>
  ios
</a></li><li class="dropdown-item"><!----> <a href="/vue-press-blog-html/categories/react/" class="nav-link"><i class="iconfont undefined"></i>
  react
</a></li></ul></div></div><div class="nav-item"><a href="/vue-press-blog-html/tag/" class="nav-link"><i class="iconfont reco-tag"></i>
  标签
</a></div><div class="nav-item"><a href="/vue-press-blog-html/timeline/" class="nav-link"><i class="iconfont reco-date"></i>
  时间轴
</a></div><div class="nav-item"><a href="/vue-press-blog-html/about/" class="nav-link"><i class="iconfont reco-account"></i>
  关于
</a></div> <!----></nav> <!----> </aside> <div class="password-shadow password-wrapper-in" style="display:none;" data-v-5cb9a64e data-v-0c5314fc><h3 class="title" style="display:none;" data-v-5cb9a64e data-v-5cb9a64e>ES6 常用功能</h3> <!----> <label id="box" class="inputBox" style="display:none;" data-v-5cb9a64e data-v-5cb9a64e><input type="password" value="" data-v-5cb9a64e> <span data-v-5cb9a64e>Konck! Knock!</span> <button data-v-5cb9a64e>OK</button></label> <div class="footer" style="display:none;" data-v-5cb9a64e data-v-5cb9a64e><span data-v-5cb9a64e><i class="iconfont reco-theme" data-v-5cb9a64e></i> <a target="blank" href="https://vuepress-theme-reco.recoluan.com" data-v-5cb9a64e>vuePress-theme-reco</a></span> <span data-v-5cb9a64e><i class="iconfont reco-copyright" data-v-5cb9a64e></i> <a data-v-5cb9a64e><span data-v-5cb9a64e>茂茂</span>
            
          <span data-v-5cb9a64e>2019 - </span>
          2022
        </a></span></div></div></div> <div data-v-0c5314fc><main class="page" style="padding-right:0;"><div class="page-title" style="display:none;"><h1 class="title">ES6 常用功能</h1> <div class="page-info" data-v-0efa1f05><i class="iconfont reco-account" data-v-0efa1f05><span data-v-0efa1f05>茂茂</span></i> <i class="iconfont reco-date" data-v-0efa1f05><span data-v-0efa1f05>2019-12-28</span></i> <i class="iconfont reco-eye" data-v-0efa1f05><span id="/vue-press-blog-html/blogs/tec/2019/092104.html" data-flag-title="Your Article Title" class="leancloud-visitors" data-v-0efa1f05><a class="leancloud-visitors-count" style="font-size:.9rem;font-weight:normal;color:#999;"></a></span></i> <i class="iconfont reco-tag tags" data-v-0efa1f05><span class="tag-item" data-v-0efa1f05>es6</span><span class="tag-item" data-v-0efa1f05>前端</span></i></div></div> <div class="theme-reco-content content__default" style="display:none;"><h2 id="es6-常用功能"><a href="#es6-常用功能" class="header-anchor">#</a> ES6 常用功能</h2> <h3 id="let-const"><a href="#let-const" class="header-anchor">#</a> let / const</h3> <p>es6 以前，都是用 var 关键字来标识，这样有个变量提升的坑。在 es6 中，添加了 let
和 const 两个关键字，let 定义变量，const 定义常量，并且添加了块级作用域</p> <p>var的变量提升：</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code>console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>a<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// undefined</span>
<span class="token keyword">var</span> a <span class="token operator">=</span> <span class="token number">100</span>
</code></pre></div><h3 id="多行字符串-模板变量"><a href="#多行字符串-模板变量" class="header-anchor">#</a> 多行字符串 / 模板变量</h3> <p>在 es6 之前，字符串的拼接是这样的：</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">var</span> name <span class="token operator">=</span> <span class="token string">&quot;李四&quot;</span>
<span class="token keyword">var</span> age <span class="token operator">=</span> <span class="token number">18</span>
<span class="token keyword">var</span> myIntro <span class="token operator">=</span> <span class="token string">''</span>
myIntro <span class="token operator">+=</span> <span class="token string">'my name is '</span> <span class="token operator">+</span> name <span class="token operator">+</span> <span class="token string">', '</span>
myIntro <span class="token operator">+=</span> <span class="token string">'my age is '</span> <span class="token operator">+</span> age

</code></pre></div><p>在 es6 中，可以使用模板字符串 `` 和模板变量 ${ } ：</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">const</span> name <span class="token operator">=</span> <span class="token string">&quot;李四&quot;</span>
<span class="token keyword">const</span> age <span class="token operator">=</span> <span class="token number">18</span>
<span class="token keyword">const</span> myIntro <span class="token operator">=</span> `my name is $<span class="token punctuation">{</span>name<span class="token punctuation">}</span><span class="token punctuation">,</span> 
                 my age is $<span class="token punctuation">{</span>age<span class="token punctuation">}</span>
</code></pre></div><h3 id="解构赋值"><a href="#解构赋值" class="header-anchor">#</a> 解构赋值</h3> <p>顾名思义，就是先解构，再赋值！
比如先定义一个对象和数组：</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">var</span> obj <span class="token operator">=</span> <span class="token punctuation">{</span>
    a<span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
    b<span class="token operator">:</span> <span class="token number">2</span><span class="token punctuation">,</span>
    c<span class="token operator">:</span> <span class="token number">3</span>
<span class="token punctuation">}</span>
<span class="token keyword">var</span> arr <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">,</span><span class="token number">3</span><span class="token punctuation">]</span>

</code></pre></div><p>在 es6 以前，这样获取属性的值：</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code>obj<span class="token punctuation">.</span>a
obj<span class="token punctuation">.</span>b
arr<span class="token punctuation">[</span>i<span class="token punctuation">]</span>
</code></pre></div><p>在 es6 中：</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">const</span> <span class="token punctuation">{</span>a<span class="token punctuation">,</span>c<span class="token punctuation">}</span> <span class="token operator">=</span> obj
<span class="token keyword">const</span> <span class="token punctuation">[</span>x<span class="token punctuation">,</span>y<span class="token punctuation">,</span>z<span class="token punctuation">]</span> <span class="token operator">=</span> arr
</code></pre></div><p>使用 const {a,c} = obj 这种方式获取对象的属性的方法时，大括号中的变量对象对象的
属性，使用 const [x,y,z] = arr 这种方式获取数组的元素，中括号中的变量的索引对应
真正数组的索引，即：x 是第一个，对应 arr 数组中的第一个，z 是数组的第三个，对应 arr 数组的第三个。</p> <h3 id="块级作用域"><a href="#块级作用域" class="header-anchor">#</a> 块级作用域</h3> <p>在 es6 以前：</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">var</span> obj <span class="token operator">=</span> <span class="token punctuation">{</span>
    a<span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
    b<span class="token operator">:</span> <span class="token number">2</span><span class="token punctuation">,</span>
    c<span class="token operator">:</span> <span class="token number">3</span>
<span class="token punctuation">}</span>
<span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">var</span> item <span class="token keyword">in</span> obj<span class="token punctuation">)</span> <span class="token punctuation">{</span>
    console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>item<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>item<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre></div><p>变量 item 其实是在循环外部，咱们预想是访问不到的，但是实际是可以访问到的，
以上写法相当于将 var item 提到最前面，就好理解了，这样子的话变量 item 相当
于是在全局都可以访问的，这与我们的预期是相违背的。</p> <p>再来看看 es6 中：</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">const</span> obj <span class="token operator">=</span> <span class="token punctuation">{</span>
    a<span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
    b<span class="token operator">:</span> <span class="token number">2</span><span class="token punctuation">,</span>
    c<span class="token operator">:</span> <span class="token number">3</span>
<span class="token punctuation">}</span>
<span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">let</span> key <span class="token keyword">in</span> obj<span class="token punctuation">)</span> <span class="token punctuation">{</span>
    console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>key<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>key<span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre></div><p>因为有块级作用域的概念，所以循环中的 key 变量只在循环中能使用,循环里面的
key 和 外面的 key 不是同一个东西</p> <h3 id="函数默认参数"><a href="#函数默认参数" class="header-anchor">#</a> 函数默认参数</h3> <p>首先来设定一个场景：有一个函数 test ，可能给它传一个参数，也可能传两个，
传一个参数时，第二个参数给个默认值，在 es6 以前这样判断：</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">function</span> <span class="token function">test</span> <span class="token punctuation">(</span><span class="token parameter">a<span class="token punctuation">,</span> b</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>b <span class="token operator">==</span> <span class="token keyword">null</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
        b <span class="token operator">=</span> <span class="token number">0</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre></div><p>但是在 es6 中写法非常简单：</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">function</span> <span class="token function">test</span> <span class="token punctuation">(</span><span class="token parameter">a<span class="token punctuation">,</span> b <span class="token operator">=</span> <span class="token number">0</span></span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token comment">// ...</span>
<span class="token punctuation">}</span>
</code></pre></div><p>es6的写法也就是在内部做了一个判断：如果参数的个数大于1，并且第二个参数不是undefined，
那么就将第二个参数赋值给 b，否则b = 0。这个跟上面的 es6 之前的判断是一致的，这种写法特别简单、易读！</p> <h3 id="箭头函数"><a href="#箭头函数" class="header-anchor">#</a> 箭头函数</h3> <p>用 map 遍历数组
es6 以前：</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">var</span> arr <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token number">100</span><span class="token punctuation">,</span> <span class="token number">200</span><span class="token punctuation">,</span> <span class="token number">300</span><span class="token punctuation">]</span>
arr<span class="token punctuation">.</span><span class="token function">map</span><span class="token punctuation">(</span><span class="token keyword">function</span> <span class="token punctuation">(</span><span class="token parameter">item</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> item <span class="token operator">+</span> <span class="token number">1</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span>
</code></pre></div><p>es6 写法：</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">const</span> arr <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token number">100</span><span class="token punctuation">,</span> <span class="token number">200</span><span class="token punctuation">,</span> <span class="token number">300</span><span class="token punctuation">]</span>
arr<span class="token punctuation">.</span><span class="token function">map</span><span class="token punctuation">(</span><span class="token parameter">item</span> <span class="token operator">=&gt;</span> item <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">)</span>
</code></pre></div><p>当函数只有一个参数，并且函数体中只有一行代码时，可以简写成上面的形式，参数有多个，函数体中超过一行这样写：</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code>arr<span class="token punctuation">.</span><span class="token function">map</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token parameter">item<span class="token punctuation">,</span>index</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
    console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>index<span class="token punctuation">,</span> item<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">return</span> item <span class="token operator">+</span> <span class="token number">1</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span>
</code></pre></div><p>this 指向：</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">function</span> <span class="token function">test</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">'test'</span><span class="token punctuation">,</span> <span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">var</span> arr <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">,</span><span class="token number">3</span><span class="token punctuation">]</span>
    arr<span class="token punctuation">.</span><span class="token function">map</span><span class="token punctuation">(</span><span class="token keyword">function</span> <span class="token punctuation">(</span><span class="token parameter">item</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
        console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>item<span class="token punctuation">,</span> <span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token punctuation">}</span>
<span class="token function">test</span><span class="token punctuation">.</span><span class="token function">call</span><span class="token punctuation">(</span><span class="token punctuation">{</span>a<span class="token operator">:</span> <span class="token number">100</span><span class="token punctuation">}</span><span class="token punctuation">)</span>

</code></pre></div><p><img src="/thiszx01.png" alt="this指向"></p> <p>很明显，map 中的 this 是 window 对象。这是 js 的一个大坑，在这个情况下，通过
call 绑定了一个 this 是 { a: 100 } 这个对象，但是 map 中的 this 却是 window 。
这是因为 this 的取值是在其调用时决定的，而 map 中的函数相当于调用一个普通函数，
而普通函数的作用域在全局，其 this 就指向了 window 。而箭头函数很好的解决了这个问题，
箭头函数中的 this 与其上一个作用域的 this ，在此处中，map 中的 上一级作用域是 test
函数，而 test 函数的 this 是 { a: 100 } 对象。</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">function</span> <span class="token function">test</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">'test'</span><span class="token punctuation">,</span> <span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">var</span> arr <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">,</span><span class="token number">3</span><span class="token punctuation">]</span>
    arr<span class="token punctuation">.</span><span class="token function">map</span><span class="token punctuation">(</span> <span class="token parameter">item</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
        console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>item<span class="token punctuation">,</span> <span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token punctuation">}</span>
<span class="token function">test</span><span class="token punctuation">.</span><span class="token function">call</span><span class="token punctuation">(</span><span class="token punctuation">{</span>a<span class="token operator">:</span> <span class="token number">100</span><span class="token punctuation">}</span><span class="token punctuation">)</span>

</code></pre></div><p><img src="/thiszx02.png" alt="this指向"></p> <h3 id="模块化"><a href="#模块化" class="header-anchor">#</a> 模块化</h3> <p>在现在多个人开发同一个项目很常见，每个人负责不同的模块，还有可能会几个人使用
同一个模块，在这种情况下，模块化就很重要！其实使用起来也很简单，比如说有模块
A、B、C三个 js 文件，各自在其中定义好自己的代码，使用 export 关键字导出自己
的东西，别人使用时用 import 关键字引用即可，模块化的处理工具有 webpack、rollup
等。如果你有兴趣，详情可以看看<a href="https://blog.csdn.net/wwwqiaoling/article/details/104375012" target="_blank" rel="noopener noreferrer">ES6 模块化<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>
如何使用，开发环境如何打包，欢迎指正。</p> <h3 id="class"><a href="#class" class="header-anchor">#</a> class</h3> <p>标题是 class， 但是实际上应该说是构造函数：
es6以前，js 构造函数：</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">function</span> <span class="token function">MathPlus</span> <span class="token punctuation">(</span><span class="token parameter">x<span class="token punctuation">,</span> y</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span>x <span class="token operator">=</span> x
    <span class="token keyword">this</span><span class="token punctuation">.</span>y <span class="token operator">=</span> y
<span class="token punctuation">}</span>
<span class="token class-name">MathPlus</span><span class="token punctuation">.</span>prototype<span class="token punctuation">.</span><span class="token function-variable function">getAddResult</span> <span class="token operator">=</span> <span class="token keyword">function</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token keyword">this</span><span class="token punctuation">.</span>x <span class="token operator">+</span> <span class="token keyword">this</span><span class="token punctuation">.</span>y
<span class="token punctuation">}</span>
<span class="token keyword">var</span> testAdd <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">MathPlus</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">)</span>
console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>testAdd<span class="token punctuation">.</span><span class="token function">getAddResult</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// 3</span>

</code></pre></div><p>es6 中 class 写法：</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">class</span> <span class="token class-name">MathPlus</span> <span class="token punctuation">{</span>
    <span class="token function">constructor</span><span class="token punctuation">(</span><span class="token parameter">x<span class="token punctuation">,</span> y</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">this</span><span class="token punctuation">.</span>x <span class="token operator">=</span> x
        <span class="token keyword">this</span><span class="token punctuation">.</span>y <span class="token operator">=</span> y
    <span class="token punctuation">}</span>
    <span class="token function">getAddResult</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">return</span> <span class="token keyword">this</span><span class="token punctuation">.</span>x <span class="token operator">+</span> <span class="token keyword">this</span><span class="token punctuation">.</span>y
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token keyword">const</span> testAddEs6 <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">MathPlus</span><span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">,</span><span class="token number">4</span><span class="token punctuation">)</span>
console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>testAddEs6<span class="token punctuation">.</span><span class="token function">getAddResult</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// 7</span>

</code></pre></div><p>js 定义构造函数和 es6 中的 class 的所实现目的一样的，但是 class 就看起来更加清晰、
易懂！在 js 的构造函数中，在其原型上定义方法从而实现，而 class 中直接在 { } 中写
函数就可以直接实现这个类中有这个函数了。</p> <p>本质：
其实 class 的本质其实是一个语法糖：
理解起来就是，二者实现的东西是一样的，只是有个的写法更简洁、易读、易懂。对应一下，
其实 class 所实现的东西和 js 的构造函数是一样的，class 的实现原理和 js 构造函数是一样的，都是通过原型实现的。</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code>console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token keyword">typeof</span> MathPlus<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// function</span>
console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span> <span class="token class-name">MathPlus</span><span class="token punctuation">.</span>prototype <span class="token operator">===</span> testAddEs6<span class="token punctuation">.</span>__proto__ <span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// true</span>
console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span> MathPlus <span class="token operator">===</span> <span class="token class-name">MathPlus</span><span class="token punctuation">.</span>prototype<span class="token punctuation">.</span>constructor <span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// true</span>

</code></pre></div><p>以上的结果和 js 的构造函数是一致的，MathPlus 这个 class 的本质是一个function ，
其实例 testAddEs6 有一个隐式原型 <strong>proto</strong> ，并且和 MathPlus 的 prototype 三等。</p> <p>关于继承：
js 实现继承：</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">function</span> <span class="token function">Math</span> <span class="token punctuation">(</span><span class="token parameter">x<span class="token punctuation">,</span> y</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span>x <span class="token operator">=</span> x
    <span class="token keyword">this</span><span class="token punctuation">.</span>y <span class="token operator">=</span> y
<span class="token punctuation">}</span>
<span class="token class-name">Math</span><span class="token punctuation">.</span>prototype<span class="token punctuation">.</span><span class="token function-variable function">getSubResult</span> <span class="token operator">=</span> <span class="token keyword">function</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token keyword">this</span><span class="token punctuation">.</span>x <span class="token operator">-</span> <span class="token keyword">this</span><span class="token punctuation">.</span>y
<span class="token punctuation">}</span>

<span class="token comment">// 通过绑定原型，实现继承</span>
<span class="token class-name">MathPlus</span><span class="token punctuation">.</span>prototype <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Math</span><span class="token punctuation">(</span><span class="token punctuation">)</span>

<span class="token keyword">var</span> testAdd <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">MathPlus</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span><span class="token number">2</span><span class="token punctuation">)</span>
<span class="token comment">// console.log(testAdd.getAddResult());</span>
console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>testAdd<span class="token punctuation">.</span><span class="token function">getSubResult</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// -1</span>

</code></pre></div><p>class 继承：</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">class</span> <span class="token class-name">Math</span> <span class="token punctuation">{</span>
    <span class="token function">constructor</span><span class="token punctuation">(</span><span class="token parameter">x<span class="token punctuation">,</span> y</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">this</span><span class="token punctuation">.</span>x <span class="token operator">=</span> x
        <span class="token keyword">this</span><span class="token punctuation">.</span>y <span class="token operator">=</span> y
    <span class="token punctuation">}</span>
    <span class="token function">getSubResult</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">return</span> <span class="token keyword">this</span><span class="token punctuation">.</span>x <span class="token operator">-</span> <span class="token keyword">this</span><span class="token punctuation">.</span>y
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token keyword">class</span> <span class="token class-name">MathPlus</span> <span class="token keyword">extends</span> <span class="token class-name">Math</span> <span class="token punctuation">{</span>
    <span class="token function">constructor</span><span class="token punctuation">(</span><span class="token parameter">x<span class="token punctuation">,</span> y</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">super</span><span class="token punctuation">(</span>x<span class="token punctuation">,</span> y<span class="token punctuation">)</span> <span class="token comment">// 重点！！！自动实现父类的 constructor</span>
        <span class="token keyword">this</span><span class="token punctuation">.</span>x <span class="token operator">=</span> x
        <span class="token keyword">this</span><span class="token punctuation">.</span>y <span class="token operator">=</span> y
    <span class="token punctuation">}</span>
    <span class="token function">getAddResult</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">return</span> <span class="token keyword">this</span><span class="token punctuation">.</span>x <span class="token operator">+</span> <span class="token keyword">this</span><span class="token punctuation">.</span>y
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token keyword">const</span> testAddEs6 <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">MathPlus</span><span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">,</span><span class="token number">4</span><span class="token punctuation">)</span>
console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>testAddEs6<span class="token punctuation">.</span><span class="token function">getAddResult</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// 7</span>
console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>testAddEs6<span class="token punctuation">.</span><span class="token function">getSubResult</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// -1</span>
console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>testAddEs6<span class="token punctuation">.</span>__proto__ <span class="token operator">===</span> <span class="token class-name">MathPlus</span><span class="token punctuation">.</span>prototype<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// true</span>
console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token class-name">MathPlus</span><span class="token punctuation">.</span>prototype<span class="token punctuation">.</span>__proto__ <span class="token operator">===</span> <span class="token class-name">Math</span><span class="token punctuation">.</span>prototype<span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// true</span>
</code></pre></div><p>看到结果其实就更能体现 class 实际上是通过原型实现的！</p> <h3 id="promise"><a href="#promise" class="header-anchor">#</a> promise</h3> <p>在项目中涉及到网络请求资源时，就要调用后端提供的接口，常用的jQuery、axios、fetch等，
用的最多的就是 axios 调用接口之后就有回调函数，成功与否都有相应的回调函数，这个是异步的，
但是当请求比较复杂时，会出现回调地狱（callback hell），比如说：根据接口1 获取 data1 ，
在其中调用接口2 获取data 3…，用 promise 就很简单，至少看起来不会那么复杂。
首先我们先封装一个根据接口 URL 获取数据的通用方法 getData ：</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">function</span> <span class="token function">getData</span><span class="token punctuation">(</span><span class="token parameter">url</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token keyword">new</span> <span class="token class-name">Promise</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token parameter">resolve<span class="token punctuation">,</span> reject</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
        $<span class="token punctuation">.</span><span class="token function">ajax</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
            url<span class="token punctuation">,</span>
            <span class="token function-variable function">success</span><span class="token operator">:</span> <span class="token punctuation">(</span><span class="token parameter">data</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
                <span class="token function">resolve</span><span class="token punctuation">(</span>data<span class="token punctuation">)</span>
            <span class="token punctuation">}</span><span class="token punctuation">,</span>
            <span class="token function-variable function">error</span><span class="token operator">:</span> <span class="token punctuation">(</span><span class="token parameter">data</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
                <span class="token function">reject</span><span class="token punctuation">(</span>data<span class="token punctuation">)</span>
            <span class="token punctuation">}</span>
        <span class="token punctuation">}</span><span class="token punctuation">)</span>
    <span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token punctuation">}</span>

</code></pre></div><p>getData 函数中，返回了一个 promise 实例，resolve 表示成功时调用的回调函数，
reject 表示失败时调用的回调函数。那么，对于上面比较复杂的情况就可以写成：</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token function">getData</span><span class="token punctuation">(</span>url1<span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">data1</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
    console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>data1<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">return</span> <span class="token function">getData</span><span class="token punctuation">(</span>url2<span class="token punctuation">)</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">then</span><span class="token punctuation">(</span><span class="token parameter">data2</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
    console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>data2<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">return</span> <span class="token function">getData</span><span class="token punctuation">(</span>url3<span class="token punctuation">)</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">catch</span><span class="token punctuation">(</span><span class="token parameter">err</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
    console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>err<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span>

</code></pre></div></div> <footer class="page-edit" style="display:none;"><!----> <div class="last-updated"><span class="prefix">Last Updated: </span> <span class="time">2022/1/5 下午4:20:07</span></div></footer> <!----> <!----> <!----></main> <!----></div></div></div></div></div><div class="global-ui"><div class="back-to-ceiling" style="right:1rem;bottom:6rem;width:2.5rem;height:2.5rem;border-radius:.25rem;line-height:2.5rem;display:none;" data-v-c6073ba8 data-v-c6073ba8><svg t="1574745035067" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5404" class="icon" data-v-c6073ba8><path d="M526.60727968 10.90185116a27.675 27.675 0 0 0-29.21455937 0c-131.36607665 82.28402758-218.69155461 228.01873535-218.69155402 394.07834331a462.20625001 462.20625001 0 0 0 5.36959153 69.94390903c1.00431239 6.55289093-0.34802892 13.13561351-3.76865779 18.80351572-32.63518765 54.11355614-51.75690182 118.55860487-51.7569018 187.94566865a371.06718723 371.06718723 0 0 0 11.50484808 91.98906777c6.53300375 25.50556257 41.68394495 28.14064038 52.69160883 4.22606766 17.37162448-37.73630017 42.14135425-72.50938081 72.80769204-103.21549295 2.18761121 3.04276886 4.15646224 6.24463696 6.40373557 9.22774369a1871.4375 1871.4375 0 0 0 140.04691725 5.34970492 1866.36093723 1866.36093723 0 0 0 140.04691723-5.34970492c2.24727335-2.98310674 4.21612437-6.18497483 6.3937923-9.2178004 30.66633723 30.70611158 55.4360664 65.4791928 72.80769147 103.21549355 11.00766384 23.91457269 46.15860503 21.27949489 52.69160879-4.22606768a371.15156223 371.15156223 0 0 0 11.514792-91.99901164c0-69.36717486-19.13165746-133.82216804-51.75690182-187.92578088-3.42062944-5.66790279-4.76302748-12.26056868-3.76865837-18.80351632a462.20625001 462.20625001 0 0 0 5.36959269-69.943909c-0.00994388-166.08943902-87.32547796-311.81420293-218.6915546-394.09823051zM605.93803103 357.87693858a93.93749974 93.93749974 0 1 1-187.89594924 6.1e-7 93.93749974 93.93749974 0 0 1 187.89594924-6.1e-7z" p-id="5405" data-v-c6073ba8></path><path d="M429.50777625 765.63860547C429.50777625 803.39355007 466.44236686 1000.39046097 512.00932183 1000.39046097c45.56695499 0 82.4922232-197.00623328 82.5015456-234.7518555 0-37.75494459-36.9345906-68.35043303-82.4922232-68.34111062-45.57627738-0.00932239-82.52019037 30.59548842-82.51086798 68.34111062z" p-id="5406" data-v-c6073ba8></path></svg></div><div class="kanbanniang" data-v-5775ee02><div class="banniang-container" style="display:;" data-v-5775ee02><div class="messageBox" style="right:68px;bottom:190px;display:none;" data-v-5775ee02>
      我是王茂铭谢谢你的关注 
    </div> <div class="operation" style="right:90px;bottom:40px;display:;" data-v-5775ee02><i class="kbnfont kbn-ban-home ban-home" data-v-5775ee02></i> <i class="kbnfont kbn-ban-message message" data-v-5775ee02></i> <i class="kbnfont kbn-ban-close close" data-v-5775ee02></i> <a target="_blank" href="https://vuepress-theme-reco.recoluan.com/views/plugins/kanbanniang.html" data-v-5775ee02><i class="kbnfont kbn-ban-info info" data-v-5775ee02></i></a> <i class="kbnfont kbn-ban-theme skin" style="display:;" data-v-5775ee02></i></div> <canvas id="banniang" width="240" height="352" class="live2d" style="right:90px;bottom:-20px;opacity:0.9;" data-v-5775ee02></canvas></div> <div class="showBanNiang" style="display:none;" data-v-5775ee02>
    看板娘
  </div></div><canvas id="vuepress-canvas-cursor"></canvas><APlayer audio="" fixed="true" mini="true" autoplay="autoplay" theme="#b7daff" loop="loop" order="random" preload="auto" volume="0.2" mutex="true" lrc-type="1" list-max-height="250" storage-name="vuepress-plugin-meting" id="aplayer-fixed"></APlayer></div></div>
    <script src="/vue-press-blog-html/assets/js/app.0c76d487.js" defer></script><script src="/vue-press-blog-html/assets/js/5.12b1c0e9.js" defer></script><script src="/vue-press-blog-html/assets/js/1.6e6d8766.js" defer></script><script src="/vue-press-blog-html/assets/js/25.006a8aa9.js" defer></script>
  </body>
</html>
